#include <stdio.h>
int add(int x, int y)
{
    return x + y;
}
int sub(int x, int y)
{
    return x - y;
}
int div(int x, int y)
{
    return x / y;
}

int mul(int x, int y)
{

    return x * y;
}
int cal(int (*p)(int ,int))
{   int x = 0;
    int y = 0;
    printf("input x & y:");
    scanf("%d %d",&x,&y);
    return p(x,y);
}
int main()
{printf("################\n");
    printf("#####0:exit####\n");
    printf("#####1:add#####\n");
    printf("#####2:sub#####\n");
    printf("#####3:div#####\n");
    printf("#####4:mul#####\n");
    int input = 0 ;

    do {
        printf("select function\n");
        scanf("%d", &input);
        switch (input) {
            case 0:
                printf("exit\n");
                break;
            case 1:
                printf("%d\n",cal(add));
                break;
            case 2:
                printf("%d\n",cal(sub));
                break;
            case 3://除法
                printf("%d\n",cal(div));
                break;
            case 4://乘法
                printf("%d\n",cal(mul));
                break;
            default:
                printf("error input\n");
                break;

        }
    } while (input);

    return 0;
}